<template>
    <div class="page">
        <div class="page_header" style="display: flex;">
            <div style="flex: 1 1 auto">
                <el-form ref="searchForm" :model="searchForm" style="display: flex;">
                    <el-form-item prop="nickname">
                        <el-input v-model="searchForm.nickname" placeholder="微信名"></el-input>
                    </el-form-item>
                    <el-form-item prop="openid">
                        <el-input v-model="searchForm.openid" placeholder="openid"></el-input>
                    </el-form-item>
                    <el-form-item prop="phone">
                        <el-input v-model="searchForm.phone" placeholder="手机号"></el-input>
                    </el-form-item>
                    <el-form-item prop="time">
                        <el-date-picker
                                v-model="searchForm.time"
                                type="datetimerange"
                                value-format="yyyy-MM-dd HH:mm:ss"
                                start-placeholder="注册起期"
                                end-placeholder="注册止期">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item prop="vip_id">
                        <el-select v-model="searchForm.vip_id" multiple placeholder="会员类型">
                            <el-option
                                    v-for="item in laifei.vips"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-form>
            </div>
            <div>
                <el-button @click="$store.dispatch('tableReload')" type="primary">查询</el-button>
                <el-button @click="$store.dispatch('tableReset')">重置</el-button>
            </div>
        </div>
        <el-card class="page_body">
            <el-table
                    height="10"
                    class="page_body_table"
                    :data="common.tableData"
                    v-loading="common.loading"
                    border
                    stripe
                    style="width: 100%">
                <el-table-column prop="v_id" width="80" label="编号"></el-table-column>
                <el-table-column prop="nickname" width="100" label="微信名称"></el-table-column>
                <el-table-column prop="openid" label="openid"></el-table-column>
                <el-table-column prop="phone" width="120" label="手机号"></el-table-column>

                <el-table-column prop="subtitle" width="80" label="会员等级"></el-table-column>
                <el-table-column prop="adviser" width="80" label="顾问"></el-table-column>
                <!--            <el-table-column label="会员卡类型" width="90">月卡</el-table-column>-->
                <el-table-column prop="start_time" label="注册时间"></el-table-column>
                <el-table-column prop="end_time" label="到期时间"></el-table-column>

                <el-table-column prop="status_str" label="状态" width="60"></el-table-column>
                <el-table-column prop="begin_time" label="首次开通时间"></el-table-column>
                <el-table-column label="操作" width="80" align="center">
                    <template slot-scope="scope">
                        <el-button type="text" @click="$refs.vipDetail.init(scope.row.v_id)">查看详情</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <pagination class="page_body_pagination"></pagination>
        </el-card>
        <vip-detail-dialog ref="vipDetail"></vip-detail-dialog>
    </div>
</template>

<script>
    import {mapState} from 'vuex';
    import Pagination from "../Pagination";
    import VipDetailDialog from "./Dialog/VipDetailDialog";
    export default {
        name: "Vip",
        computed:{
            ...mapState(['common','laifei']),
        },
        components:{
            Pagination,
            VipDetailDialog
        },
        data(){
            return {
                method:'post',
                url:'/api/laifei/vip/store',
                searchForm:{
                    nickname:'',
                    openid:'',
                    phone:'',
                    vip_id:[],
                    time:[],
                },
            }
        },
        created(){
            this.$store.dispatch('pageInit', this);
        },
        methods:{

        },
    }
</script>

<style scoped>

</style>